// 导航站点设置
var Config = getMStr(function(){
    var sites;
/*
门户网站
    淘小众, http://taoxiaozhong.com/dh
    小书匠, http://markdown.xiaoshujiang.com/
    三泰虎, http://www.santaihu.com/
    龙腾网, http://www.ltaaa.com/
    杭州买房, https://github.com/houshanren/hangzhou_house_knowledge
    长沙住建委, http://szjw.changsha.gov.cn/zwgk/xxgkzn/
    0731房产, http://floor.0731fdc.com/builds.php
    环球网, http://www.huanqiu.com/,  img/huanqiu.ico
    凤凰网, http://www.ifeng.com/,  img/fenghuang.ico
    淘小众, http://taoxiaozhong.com/dh, img/taoxiaozhong.png
    阳光导航, http://gps.sunbox.cc/,  img/sunbox.png
兴趣阅读
    gitBook, https://www.gitbook.com/explore
    love2, https://love2.io/
    helloGitHub, https://github.com/521xueweihan/HelloGitHub
    大牛们的leetcode，https://github.com/Blankj/awesome-java-leetcode
    google+, https://plus.google.com
    极客公园, http://www.geekpark.net/, img/geekpark.ico
    36氪, http://36kr.com/, img/36k.ico
    知乎, http://www.zhihu.com/,  img/zhihu.ico
    花瓣, http://huaban.com/,  img/huaban.ico
    简书, http://www.jianshu.com/,  img/jianshu.ico
    计算机英语, https://github.com/byoungd/English-level-up-tips-for-Chinese
    煎蛋, http://jandan.net/,  img/jandan.ico
    高楼迷, http://www.gaoloumi.com/
    水库论坛, http://www.shuikult.net/
网盘搜索
    盘搜搜, http://www.pansoso.com/, img/pansoso.png
    盘搜, http://www.pansou.com/, img/pansou.png
    趣转盘, http://www.quzhuanpan.com/, img/quzhuanpan.png
    特百度, http://www.tebaidu.com/, img/tebaidu.png
    网盘搜, http://www.wangpansou.com/, img/wangpansou.png
    爱文件文库 , http://aiwenjian.com/
    云盘万能钥匙, http://www.ypsuperkey.com/
    网盘搜索, https://so.ncckl.cn/
编程
    DockOne, http://dockone.io/
    开源中国, https://gitee.com/ , img/gitee.png
    Github, http://github.com/
    牛客网, https://www.nowcoder.com/ta/leetcode
    Greasyfork, https://greasyfork.org/scripts, img/userscript.png
    Userstyles, https://userstyles.org/, img/userstyles.png
    卡饭火狐, http://bbs.kafan.cn/forum-215-1.html, img/kafan.ico
    火狐贴吧, http://tieba.baidu.com/f?ie=utf-8&kw=firefox, img/tieba.png
    阳光盒子, http://sunbox.cc/, img/sunbox.png
    CTOLib, https://go.ctolib.com/
    
社区交流
    赚客吧, http://www.zuanke8.com/
    V2EX, http://www.v2ex.com/, img/v2ex.png
    HP, https://hacpai.com/
    豆瓣, http://www.douban.com/, img/douban.ico
    贴吧, http://tieba.baidu.com/, img/tieba.png
    天涯社区, http://focus.tianya.cn/, img/tianya.ico
    猫扑, http://www.mop.com/, img/mop.ico
    nsaneforums破解软件, http://www.nsaneforums.com/, img/nsaneforums.ico

在线应用
    谷歌翻译, http://translate.google.cn/, img/gtrans.ico
    在线UML, http://draw.io
    够低调, http://goudidiao.com/
    站长工具, http://tool.oschina.net/, img/tools.ico
    百度云, http://pan.baidu.com/disk/home?, img/baiduyun.ico
    在线录音, http://vocaroo.com/, img/resizeApi.php.png
    live邮箱, http://home.live.com/, img/live.ico
    TinyPNG, https://tinypng.com/, img/tinypng.ico
    
视频门户
    Youtube, https://www.youtube.com/, img/youtube.png
    优酷视频, http://www.youku.com/, img/youku.ico
    爱奇艺, http://v.iqiyi.com/, img/iqiyi.ico
    腾讯视频, http://v.qq.com/index.html, img/vqq.ico
    乐视, http://www.letv.com/, img/letv.ico
    搜狐视频, http://tv.sohu.com/, img/vsouhu.ico
    芒果, http://www.hunantv.com/, img/hunantv.ico
    风行, http://www.fun.tv/, img/fun.ico
    
影音娱乐
    网易云音乐, http://music.163.com/, img/music.ico
    虾米, http://www.xiami.com/, img/xiami.ico
    乐随心动, https://music.mli.im/vip.music
    百度随心听, http://fm.baidu.com/, img/baidufm.ico
    阳光电台, http://sunbox.cc/sunbox-fm.html, img/sunboxfm.ico    
    全集网, http://www.loldytt.com/, img/loldytt.ico
    AcFun, http://www.acfun.tv/, img/acfun.ico
    哔哩哔哩, http://www.bilibili.com/, img/bilibili.ico
    
软件下载
    52破解, http://www.52pojie.cn
    PortableApps, http://portableapps.com/,  img/portableapps.ico
    PlayApk, https://apps.evozi.com/apk-downloader/
    zd423, http://www.423down.com/
    胡萝卜周, http://www.carrotchou.blog/
    易破解, http://www.yipojie.cn/
    懒得勤快, https://masuit.com/
    ccava, https://www.ccava.net/
    8号站, http://www.ssdtop.com/
    卡饭下载, http://bbs.kafan.cn/forum-65-1.html,  img/kafan.ico
    睿派克, http://www.repaik.com/,  img/repaik.ico
    异次元, http://www.iplaysoft.com/,  img/iplaysoft.ico
    
区块链
    gate, https://gateio.io/, img/gate.png
    中比特, https://www.chbtc.com/
    cex, http://www.cex.com/
    okcoin, http://www.okcoin.com/
    币安网, https://www.binance.com/, img/binance.png
    火币网, https://www.huobi.com/, img/huobi.png
    炫音论坛, http://bbs.musicool.cn/, img/musicool.ico    
    足球录像, http://www.qiuw.com/a/zuqiu/qc/, img/qiuw.ico
    电影天堂, http://www.dygod.net/, img/dianying.ico
    字幕组, http://www.zimuzu.tv/, img/zimuzu.ico
    美剧天堂, http://www.meijutt.com/, img/mp4ba.ico    
    
游戏联盟
    游侠论坛, http://game.ali213.net/, img/ali213.ico
    游民星空, http://www.gamersky.com/,  img/gamersky.ico
    多玩, http://www.duowan.com/,  img/duowan.ico
    电玩巴士, http://www.tgbus.com/,  img/tgbus.ico
    暴雪战网, http://www.battlenet.com.cn/zh/,  img/battlenet.gif    
    魔兽世界, http://www.battlenet.com.cn/wow/zh/,  img/wow.ico
    NGA, http://nga.178.com/,  img/nga.ico
    英雄联盟, http://lol.qq.com/main.shtml,  img/lol.ico
    
综合辅助
    谷歌首页, https://www.google.com/, img/googleg_lodp.ico
    百度首页, http://www.baidu.com/, img/baidu.ico
    必应首页, http://www.bing.com/, img/bing.ico
    维基百科, https://de.wikipedia.org/wiki/Wikipedia:Hauptseite, img/wiki.ico
    网盘搜索, http://so.baiduyun.me/, img/baiduyun.ico
    搜索图标, http://www.easyicon.net/, img/easyicon.ico
    BookLink, http://booklink.me/, img/booklink.png
    装逼大全, http://zhuangbi.info/, img/bi.png
*/


});

// 搜索引擎设置
$(document).ready(function(){

	$('#Searchtype ul li a').on('click', function(){
		$(this).parent().addClass('active').siblings().removeClass('active');
		$('#Searchbox').submit();
	});
	
	$('#Searchbox').submit(function() {
		var type = $('#Searchtype li.active a').attr('lang');
		var que = $('input[name="wd"]').val();
		if(que !== '') {
			switch (type) {
				case 'Bing':
					searchstr='http://www.bing.com/search?q=' + que;
					break;
				case 'google':
					searchstr='https://www.google.com/search?q=' + que;
					break;
				case 'baidu':
					searchstr='https://www.baidu.com/s?wd=' + que;
					break;
				case 'tieba':
					searchstr='http://tieba.baidu.com/f?kw=' + que;
					break;
				case 'baiduyun':
					searchstr='https://www.google.com/search?q=site:pan.baidu.com%20' + que;
					break;
				case 'image':
					searchstr='http://www.bing.com/images/search?q=' + que;
					break;
				case 'video':
					searchstr='http://www.soku.com/search_video/q_' + que;
					break;
				case 'music':
					searchstr='http://music.baidu.com/search?key=' + que;
					break;
				case 'YTB':
					searchstr='https://www.youtube.com/results?search_query=' + que;
					break;
				case 'shop':
					searchstr='http://s.taobao.com/search?q=' + que;
					break;
				case 'map':
					searchstr='https://www.google.com/maps/place/' + que;
					break;
				case 'kafan':
					searchstr='http://bds.kafan.cn/cse/search?q=' + que +'&s=15563968344970452529';
					break;
				case 'wiki':
					searchstr='https://zh.wikipedia.org/zh-cn/' + que;
					break;
				default:
			}
		
			if(isNewTab){
				window.open(searchstr);
				$('input[name="wd"]').val("");
			} 
			else {
				window.location.href = searchstr;
			}
			
			return false;
		}
	});
});

// 从函数中获取多行注释的字符串
function getMStr(fn) {
    var fnSource = fn.toString();
    var ret = {};
    fnSource = fnSource.replace(/^[^{]+/, '');
    // console.log(fnSource);
    var matched;
    var reg = /var\s+([$\w]+)[\s\S]*?\/\*([\s\S]+?)\*\//g;
    while (matched = reg.exec(fnSource)) {
        // console.log(matched);
        ret[matched[1]] = matched[2];
    };
    
    return ret;
}